package com.linkoog.devtools.http.toolwindow.workbenche;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.Disposer;
import com.intellij.ui.components.JBLoadingPanel;
import com.linkoog.devtools.http.raw_index.HttpServiceMethod;
import com.linkoog.devtools.http.toolwindow.workbenche.foot.HttpWorkbencheStatusFootPanel;
import com.linkoog.devtools.http.toolwindow.workbenche.left.HttpWorkbencheTestLeftPanel;
import com.linkoog.devtools.http.toolwindow.workbenche.right.HttpWorkbencheTestRightPanel;

import java.awt.*;

public class HttpWorkbenchePanel extends JBLoadingPanel implements Disposable {

    private final Project project;

    private HttpWorkbencheTestLeftPanel leftPanel;
    private HttpWorkbencheTestRightPanel rightPanel;
    private HttpWorkbencheStatusFootPanel statusFootPanel;


    public HttpWorkbenchePanel(Project project, Disposable parentDisposable) {
        super(new BorderLayout(), parentDisposable);
        Disposer.register(parentDisposable, this);
        this.project = project;

        //底部状态栏
        statusFootPanel = new HttpWorkbencheStatusFootPanel();
        this.add(statusFootPanel, BorderLayout.SOUTH);

        //左右面板
        leftPanel = new HttpWorkbencheTestLeftPanel(project, statusFootPanel);
        Disposer.register(this, leftPanel);
        rightPanel = new HttpWorkbencheTestRightPanel(project, statusFootPanel);
        Disposer.register(this, rightPanel);


        // 左右分割面板
        Splitter splitter = new Splitter(false, 0.2F);
        //splitter.setResizeEnabled(false);
        splitter.setDividerPositionStrategy(Splitter.DividerPositionStrategy.KEEP_FIRST_SIZE);
        splitter.setFirstComponent(leftPanel);
        splitter.setSecondComponent(rightPanel);
        this.add(splitter, BorderLayout.CENTER);
    }



    public void resetPanel(HttpServiceMethod httpServiceMethod) {
    }

    @Override
    public void dispose() {
    }


}
